package io.renren.modules.alarmhistory.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.renren.modules.alarmhistory.entity.AreaalarmHistoryEntity;
import io.renren.modules.alarmhistory.service.AreaalarmHistoryService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
@RestController
@RequestMapping("alarmhistory/areaalarmhistory")
public class AreaalarmHistoryController {
    @Autowired
    private AreaalarmHistoryService areaalarmHistoryService;

    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = areaalarmHistoryService.queryPage(params);

        return R.ok().put("page", page);
    }

    @RequestMapping("/info/{areaalarmNo}")
   // @RequiresPermissions("alarmhistory:areaalarmhistory:info")
    public R info(@PathVariable("areaalarmNo") Integer areaalarmNo){
		AreaalarmHistoryEntity areaalarmHistory = areaalarmHistoryService.getById(areaalarmNo);
        return R.ok().put("areaalarmHistory", areaalarmHistory);
    }

    @RequestMapping("/save")
   // @RequiresPermissions("alarmhistory:areaalarmhistory:save")
    public R save(@RequestBody AreaalarmHistoryEntity areaalarmHistory){
		areaalarmHistoryService.save(areaalarmHistory);

        return R.ok();
    }

    @RequestMapping("/update")
   // @RequiresPermissions("alarmhistory:areaalarmhistory:update")
    public R update(@RequestBody AreaalarmHistoryEntity areaalarmHistory){
		areaalarmHistoryService.updateById(areaalarmHistory);

        return R.ok();
    }

    @RequestMapping("/delete")
   // @RequiresPermissions("alarmhistory:areaalarmhistory:delete")
    public R delete(@RequestBody Integer[] areaalarmNos){
		areaalarmHistoryService.removeByIds(Arrays.asList(areaalarmNos));
        return R.ok();
    }
}
